import time

from selenium.webdriver.common.by import By
from selenium import webdriver
from Po163_0904.Base import Base


class Page(Base):
    #进入框架
    kj_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[1]/div/div[3]/div[1]/div[2]/iframe')
    def kj(self):
        self.frame(self.kj_loc)
    #断言
    dy_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[1]/div/div[3]/h2')
    def dy(self):
        self.text(self.dy_loc)
    #输入账号
    user_loc=(By.NAME,'email')
    def username(self,username):
        self.send_keys(self.user_loc,username)
    #输入密码
    pass_loc=(By.NAME,'password')
    def password(self,password):
        self.send_keys(self.pass_loc,password)
    #点击登录
    login_loc=(By.XPATH,'//*[@id="dologin"]')
    def login(self):
        self.click(self.login_loc)


    def luoji_163_01(self,username,password):
        self.open_url('https://mail.163.com/')
        time.sleep(5)
        self.kj()
        # time.sleep(5)
        # self.dy()
        # assert "账号登录" == self.dy()
        time.sleep(3)
        self.username(username)
        self.password(password)
        self.login()
